package com.gthncz.common;

import lombok.Data;

@Data
public class CommonResult {
	
	public int code;
	public String message;
	public Object data;
	
	public CommonResult() {
		this(200, "OK");
	}
	
	public CommonResult(int code, String message) {
		this(code, message, null);
	}

	public CommonResult(int code, String message, Object data) {
		super();
		this.code = code;
		this.message = message;
		this.data = data;
	}
	
	public String toJson() {
		return String.format("{\"code\": \"%d\", \"message\": \"%s\", \"data\": \"%s\"}", code, message, data.toString());
	}
	
}
